package by.dkusch.aircompany.model.tables;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import by.dkusch.aircompany.model.tables.base.BaseEntity;

@Entity
public class Plane extends BaseEntity<Long> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@NotNull
	@Size(max = 30)
	@Column
	private String code;

	@Size(max = 50)
	@Column
	private String name;

	@NotNull
	@ManyToOne(fetch = FetchType.LAZY, targetEntity = PlaneType.class)
	@JoinColumn(name = "type_id")
	private PlaneType planeType;

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public PlaneType getPlaneType() {
		return planeType;
	}

	public void setPlaneType(PlaneType planeType) {
		this.planeType = planeType;
	}

}
